<?php

/**
 * File form.
 *
 * @package    DocFlow
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class FileForm extends BaseFileForm
{
  public function configure()
  {
      //when file will be "deleted" so in DataBase we shall must write is_deleted = true;
      unset($this['created_at'], $this['updated_at'],$this['name'],$this['lastDownloadId'], 
      	$this['is_deleted'], $this['version']);

      $this->widgetSchema['name'] = new sfWidgetFormInputFileEditable(array(
              'label'       => 'File path',
              'file_src'    => '/uploads/files/'.$this->getObject()->getName(),
              'is_image'    => false,
              'edit_mode'   => !$this->isNew(),
              'template'    => '<div>%input%</div>',
            ));

      $this->validatorSchema['name'] = new sfValidatorFile(array(
              'required'   => false,
              'path'       => sfConfig::get('sf_upload_dir').'/files',
            ));
  
      $this->setWidget('document_id', new sfWidgetFormInputHidden());
  }
}
